#include "../include/SerialControl.h"
#include <vector>
#include <string>
#include <iostream>

// 重载 operator<< 以支持 std::vector<double> 的输出
std::ostream& operator<<(std::ostream& os, const std::vector<double>& vec) {
    os << "[";
    for (size_t i = 0; i < vec.size(); ++i) {
        os << vec[i];
        if (i != vec.size() - 1) {
            os << ", ";
        }
    }
    os << "]";
    return os;
}

int main(int argc, char** argv) 
{
    // **************************"写入示例代码"**************************
    std::vector<double> rads = {0.5, 0.5, 0.5, 0.5, 0.5};

    SerialControl ser("/dev/ttyUSB0", 115200, 1000); // 1000ms

    ser.sendCommand(rads, "arm");

    ser.sendCommand("#026P1300T0800!");


    // **************************"读取示例代码"**************************
    // SerialControl ser("/dev/ttyUSB0", 115200, 1000);

    // std::vector<double> data = ser.getRadsData("arm");

    // std::cout << "data : " << data << std::endl;

    return 0;

}

